clear all
set more off


********************************************************************************
*Import Data*
********************************************************************************


use NonIdentifyingReplicationDataLegAudit.dta, clear
	


********************************************************************************
*Analysis in Text*
********************************************************************************

**Table 1** Helpful Response

ttest HelpfulResponse if  mailerdaemon!=1 & excludedErrors==0, by (FemaleSender)

ttest HelpfulResponse if democrat==1 & mailerdaemon!=1 & excludedErrors==0, by (FemaleSender)
ttest HelpfulResponse if democrat==0 & mailerdaemon!=1 & excludedErrors==0, by (FemaleSender)
reg HelpfulResponse i.FemaleSender##i.democrat if mailerdaemon!=1 & excludedErrors==0, cluster (numericLeg_id)

ttest HelpfulResponse if legFemale==1 & mailerdaemon!=1 & excludedErrors==0, by (FemaleSender)
ttest HelpfulResponse if legFemale==0 & mailerdaemon!=1 & excludedErrors==0, by (FemaleSender)
reg HelpfulResponse i.FemaleSender##i.legFemale if mailerdaemon!=1 & excludedErrors==0, cluster (numericLeg_id)

ttest HelpfulResponse if  mailerdaemon!=1 & treatmentExper==1 & excludedErrors==0, by (FemaleSender) 
ttest HelpfulResponse if  mailerdaemon!=1 & treatmentExper==0 & treatmentcoded==0 & excludedErrors==0, by (FemaleSender)
reg HelpfulResponse i.FemaleSender##i.treatmentExper if mailerdaemon!=1 & treatmentcoded<2 & excludedErrors==0, cluster (numericLeg_id)
	matrix list r(table) // extract specific pvalue

**Table 1** All Response

ttest response if  mailerdaemon!=1 & excludedErrors==0, by (FemaleSender)

ttest response if democrat==1 & mailerdaemon!=1 & excludedErrors==0, by (FemaleSender)
ttest response if democrat==0 & mailerdaemon!=1 & excludedErrors==0, by (FemaleSender)
reg response i.FemaleSender##i.democrat if mailerdaemon!=1 & excludedErrors==0, cluster (numericLeg_id)

ttest response if legFemale==1 & mailerdaemon!=1 & excludedErrors==0, by (FemaleSender)
ttest response if legFemale==0 & mailerdaemon!=1 & excludedErrors==0, by (FemaleSender)
reg response i.FemaleSender##i.legFemale if mailerdaemon!=1 & excludedErrors==0, cluster (numericLeg_id)

ttest response if  mailerdaemon!=1 & treatmentExper==1 & excludedErrors==0, by (FemaleSender) //add party experience
ttest response if  mailerdaemon!=1 & treatmentExper==0 &  treatmentcoded==0 & excludedErrors==0, by (FemaleSender) //no party experience
reg response i.FemaleSender##i.treatmentExper if mailerdaemon!=1 & treatmentcoded<2 & excludedErrors==0,  cluster (numericLeg_id)
	matrix list r(table) // extract specific pvalue

********************************************************************************
*Analysis in Appendix*
********************************************************************************

**Figure A1**
	//See R File
	
	
**Table A1**

ttest HelpfulResponse if  mailerdaemon!=1 & suspicious!=1 & excludedErrors==0, by (FemaleSender)

ttest HelpfulResponse if democrat==1 & mailerdaemon!=1 & suspicious!=1 & excludedErrors==0, by (FemaleSender)
ttest HelpfulResponse if democrat==0 & mailerdaemon!=1 & suspicious!=1 & excludedErrors==0, by (FemaleSender)
reg HelpfulResponse i.FemaleSender##i.democrat if mailerdaemon!=1 & suspicious!=1 & excludedErrors==0, cluster (numericLeg_id)

ttest HelpfulResponse if legFemale==1 & mailerdaemon!=1 & suspicious!=1 & excludedErrors==0, by (FemaleSender)
ttest HelpfulResponse if legFemale==0 & mailerdaemon!=1 & suspicious!=1 & excludedErrors==0, by (FemaleSender)
reg HelpfulResponse i.FemaleSender##i.legFemale if mailerdaemon!=1 & suspicious!=1 & excludedErrors==0, cluster (numericLeg_id)

ttest HelpfulResponse if  mailerdaemon!=1 & treatmentExper==1 & suspicious!=1 & excludedErrors==0, by (FemaleSender) //add party experience
ttest HelpfulResponse if  mailerdaemon!=1 & treatmentExper==0 & suspicious!=1 & treatmentcoded==0 & excludedErrors==0, by (FemaleSender) //no party experience
reg HelpfulResponse i.FemaleSender##i.treatmentExper if mailerdaemon!=1 & suspicious!=1 & treatmentcoded<2 & excludedErrors==0,  cluster (numericLeg_id)



**Table A2**

ttest HelpfulResponse if  mailerdaemon!=1 & FullTime==1 & excludedErrors==0, by (FemaleSender)

ttest HelpfulResponse if democrat==1 & mailerdaemon!=1 & FullTime==1 & excludedErrors==0, by (FemaleSender)
ttest HelpfulResponse if democrat==0 & mailerdaemon!=1 & FullTime==1 & excludedErrors==0, by (FemaleSender)
reg HelpfulResponse i.FemaleSender##i.democrat if mailerdaemon!=1 & FullTime==1 & excludedErrors==0, cluster (numericLeg_id)

ttest HelpfulResponse if legFemale==1 & mailerdaemon!=1 & FullTime==1 & excludedErrors==0, by (FemaleSender)
ttest HelpfulResponse if legFemale==0 & mailerdaemon!=1 & FullTime==1 & excludedErrors==0, by (FemaleSender)
reg HelpfulResponse i.FemaleSender##i.legFemale if mailerdaemon!=1 & FullTime==1 & excludedErrors==0, cluster (numericLeg_id)

ttest HelpfulResponse if  mailerdaemon!=1 & treatmentExper==1 & FullTime==1 & excludedErrors==0, by (FemaleSender) //add party experience
ttest HelpfulResponse if  mailerdaemon!=1 & treatmentExper==0 & FullTime==1 & treatmentcoded==0 & excludedErrors==0, by (FemaleSender) //no party experience
reg HelpfulResponse i.FemaleSender##i.treatmentExper if mailerdaemon!=1 & FullTime==1 & treatmentcoded<2 & excludedErrors==0,  cluster (numericLeg_id)
	


**Table A3**

ttest OpportunityResponse if  mailerdaemon!=1 & excludedErrors==0, by (FemaleSender)

ttest OpportunityResponse if democrat==1 & mailerdaemon!=1  & excludedErrors==0, by (FemaleSender)
ttest OpportunityResponse if democrat==0 & mailerdaemon!=1 & excludedErrors==0 , by (FemaleSender)
reg OpportunityResponse i.FemaleSender##i.democrat if mailerdaemon!=1 & excludedErrors==0 , cluster (numericLeg_id)

ttest OpportunityResponse if legFemale==1 & mailerdaemon!=1 & excludedErrors==0 , by (FemaleSender)
ttest OpportunityResponse if legFemale==0 & mailerdaemon!=1 & excludedErrors==0 , by (FemaleSender)
reg OpportunityResponse i.FemaleSender##i.legFemale if mailerdaemon!=1 & excludedErrors==0 , cluster (numericLeg_id)

ttest OpportunityResponse if  mailerdaemon!=1 & treatmentExper==1 & excludedErrors==0, by (FemaleSender) //add party experience
ttest OpportunityResponse if  mailerdaemon!=1 & treatmentExper==0 & treatmentcoded==0 & excludedErrors==0, by (FemaleSender) //no party experience
reg OpportunityResponse i.FemaleSender##i.treatmentExper if mailerdaemon!=1 & treatmentcoded<2 & excludedErrors==0 ,  cluster (numericLeg_id)
	matrix list r(table) //get specific pvalue
	
	
**Table A4**

ttest HelpfulResponse if mailerdaemon!=1 & StaffResponderFemale==1 & excludedErrors==0, by (FemaleSender)
ttest HelpfulResponse if mailerdaemon!=1 & StaffResponderFemale==0 & excludedErrors==0, by (FemaleSender)
reg HelpfulResponse i.FemaleSender##i.StaffResponderFemale if mailerdaemon!=1 & excludedErrors==0 , cluster (numericLeg_id)


ttest HelpfulResponse if mailerdaemon!=1 & StaffResponderFemaleFull==1 & excludedErrors==0, by (FemaleSender)
ttest HelpfulResponse if mailerdaemon!=1 & StaffResponderFemaleFull==0 & excludedErrors==0, by (FemaleSender)
reg HelpfulResponse i.FemaleSender##i.StaffResponderFemaleFull if mailerdaemon!=1 & BothVersions==1 & excludedErrors==0, cluster (numericLeg_id)


ttest HelpfulResponse if mailerdaemon!=1 & StaffResponderFemale==1 & BothVersions==1 & excludedErrors==0, by (FemaleSender)
ttest HelpfulResponse if mailerdaemon!=1 & StaffResponderFemale==0 & BothVersions==1 & excludedErrors==0, by (FemaleSender)
reg HelpfulResponse i.FemaleSender##i.StaffResponderFemale if mailerdaemon!=1 & BothVersions==1 & excludedErrors==0, cluster (numericLeg_id)


**Table A5**

ttest HelpfulResponse if  mailerdaemon!=1  , by (FemaleSender)

ttest HelpfulResponse if democrat==1 & mailerdaemon!=1 , by (FemaleSender)
ttest HelpfulResponse if democrat==0 & mailerdaemon!=1  , by (FemaleSender)
reg HelpfulResponse i.FemaleSender##i.democrat if mailerdaemon!=1  , cluster (numericLeg_id)

ttest HelpfulResponse if legFemale==1 & mailerdaemon!=1  , by (FemaleSender)
ttest HelpfulResponse if legFemale==0 & mailerdaemon!=1  , by (FemaleSender)
reg HelpfulResponse i.FemaleSender##i.legFemale if mailerdaemon!=1  , cluster (numericLeg_id)

ttest HelpfulResponse if  mailerdaemon!=1 & treatmentExper==1  , by (FemaleSender) //add party experience
ttest HelpfulResponse if  mailerdaemon!=1 & treatmentExper==0  & treatmentcoded==0 , by (FemaleSender) //no party experience
reg HelpfulResponse i.FemaleSender##i.treatmentExper if mailerdaemon!=1 & treatmentcoded<2 ,  cluster (numericLeg_id)
	matrix list r(table) //extract specific pvalue

**Table A6**

reg HelpfulResponse i.FemaleSender##i.treatmentExper i.treatmentExper##i.waveid if mailerdaemon!=1 & excludedErrors==0,  cluster (numericLeg_id)


**Table A7**

preserve

drop if excludedErrors==1

heckman HelpfulResponse FemaleSender i.treatmentcoded, select(response=FemaleSender i.treatmentcoded) twostep 

restore

**Figure A5**
	//R File
	
**Table A8** 

tab state response, row

**Table A9** 
ttest response if treatmentcoded<2 & excludedErrors==0, by (treatmentExper)
ttest response if treatmentcoded!=1 &  excludedErrors==0, by (IdeolTreatment)
	return list //extract specific pvalue


**Table A10** 
reg response mds1 if excludedErrors==0, cluster (numericLeg_id)
reg response i.treatmentExper##c.mds1 if treatmentcoded<2 & excludedErrors==0, cluster (numericLeg_id)
*reg response c.mds1##c.years_exp if excludedErrors==0, cluster (numericLeg_id) //**Not Publicly available because of identifying information**
*reg response c.mds1##i.leadership if excludedErrors==0, cluster (numericLeg_id) // **Not Publicly available because of identifying information**


**Table A11**
reg response c.Polarization##i.treatmentcoded if excludedErrors==0, cluster (numericLeg_id)


**Table A12** **Not Publicly available because of identifying information**
*reg response i.treatmentcoded##c.years_exp if treatmentcoded<2 & excludedErrors==0, cluster (numericLeg_id)
*	gen logyears_exp=log(years_exp)
*reg response i.treatmentcoded##c.logyears if treatmentcoded<2 & excludedErrors==0, cluster (numericLeg_id)


**Table A13** **Not Publicly available because of identifying information**
*reg response c.DistrictCompetition##i.treatmentcoded if treatmentcoded<2 & excludedErrors==0, cluster (numericLeg_id)


**Table A14** **Not Publicly available because of identifying information**
*reg response i.treatmentcoded##c.LegislatorIdeolExtremism if treatmentcoded!=1 & excludedErrors==0, cluster (numericLeg_id)


**Table A15** **Not Publicly available because of identifying information**
*reg response i.treatmentcoded##c.primary_share if treatmentcoded<2 & excludedErrors==0, cluster (numericLeg_id)





